<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>图片轮播</title>
</head>
<body>
    <style>
        div{
            width: 800px;
            height: 500px;
        }
    </style>
    <div>
        <img src="../img/169564.jpg" style="width: 800px; height: 500px">
    </div>
    <script>
        var img = document.getElementsByTagName('img')[0];
        const imgArr = ['169564.jpg','169565.jpg','169566.jpg'];
        var count = 0;
        setInterval(()=>{
            if (count < 2) {
                count++;
                img.src = '../img/' + imgArr[count];
            }else{
                count = -1;
            }
        },1000);
        // img.src = '../img/169565.jpg'
        // console.log(img);
    </script>
</body>
</html> 